<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人员信息')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="gray-bg">

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 select-table table-striped">
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success" onclick="$.operate.add()">
                        <i class="fa fa-plus"></i> 新增
                    </a>
                    <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                        <i class="fa fa-edit"></i> 修改
                    </a>
                    <a class="btn btn-danger" onclick="$.operate.removeAll()">
                        <i class="fa fa-remove"></i> 删除
                    </a>
                </div>
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: bootstrap-select-js"/>

<script th:inline="javascript">
    var prefix = ctx + "personnel";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185});
        queryDeptTree();
        queryUserList();
    });

    function queryUserList() {
        var options = {
            code: "id",
            uniqueId: "id",
            url : prefix +"/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "人员",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '编号'
                },
                {
                    field: 'name',
                    title: '姓名',

                },
                {
                    field: 'gender',
                    title: '性别'
                },
                {
                    field: 'post',
                    title: '职务'
                },
                {
                    field: 'salary',
                    title: '薪资',

                },
                {
                    field: 'joinDate',
                    title: '入职时间'
                },
                {
                    field: 'status',
                    title: '状态',

                }
            ]
        };
        $.table.init(options);
    }

    function queryDeptTree() {
        var url = ctx + "system/dept/treeData";
        var options = {
            url: url,
            expandLevel: 2,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            $("#deptId").val(treeNode.id);
            $("#parentId").val(treeNode.pId);
            $.table.search();
        }
    }


</script>
</body>

</html>